<table border="1">
	<tr>
		<th bgcolor="#c0c0c0">OR</th>	
		<th bgcolor="#c0c0c0">NOME</th>
		<th bgcolor="#c0c0c0">DN</th>
		<th bgcolor="#c0c0c0">ENDEREÇO</th>
		<th bgcolor="#c0c0c0">QUADRA</th>
		<th bgcolor="#c0c0c0">CIDADE</th>
		<th bgcolor="#c0c0c0">TELEFONE</th>
		<th bgcolor="#c0c0c0">OBSERVAÇÃO</th>
	</tr>
	<?php foreach($usuarios as $usuario): ?>
	<?php $residentes = UsuarioTable::carregarResidentes($usuario['id_usuario'])?>
	<tr>
		<td><?php echo $usuario['prontuario']?></td>	
		<td><?php echo $usuario['nome']?></td>
		<td><?php echo $usuario['data_nascimento']?></td>
		<td><?php echo $usuario['endereco']?></td>
		<td></td>
		<td><?php echo $usuario['regiao']?></td>
		<td>
			<?php 
				$telefones = array();
				if($usuario['telefone_fixo'] != '')
					$telefones[] = $usuario['telefone_fixo'];
				if($usuario['telefone_celular'] != '')
					$telefones[] = $usuario['telefone_celular'];
				if($usuario['telefone_comercial'] != '')
					$telefones[] = $usuario['telefone_comercial'];
					
				echo implode(' / ', $telefones); 
			?>
		</td>
		<td><?php echo $usuario['observacao']?></td>
	</tr>
	<?php if(count($residentes)): ?>
	<tr>
		<td colspan="8">
			<table style="background-color: #ededed;" border="1">
	<?php endif; ?>
		
		<?php foreach($residentes as $residente): ?>
		<tr>
			<td bgcolor="#ededed"><?php echo $residente['prontuario']?></td>	
			<td bgcolor="#ededed"><?php echo $residente['nome']?></td>
			<td bgcolor="#ededed"><?php echo $residente['data_nascimento']?></td>
			<td bgcolor="#ededed"><?php echo $residente['endereco']?></td>
			<td bgcolor="#ededed"></td>
			<td bgcolor="#ededed"><?php echo $residente['regiao']?></td>
			<td bgcolor="#ededed">
				<?php 
					$telefones = array();
					if($residente['telefone_fixo'] != '')
						$telefones[] = $residente['telefone_fixo'];
					if($residente['telefone_celular'] != '')
						$telefones[] = $residente['telefone_celular'];
					if($residente['telefone_comercial'] != '')
						$telefones[] = $residente['telefone_comercial'];
						
					echo implode(' / ', $telefones); 
				?>
			</td>
			<td bgcolor="#ededed"><?php echo $residente['observacao']?></td>
		</tr>
		<?php endforeach;?>
	<?php if(count($residentes)): ?>
			</table>
		</td>
	</tr>
	<?php endif; ?>
	<?php endforeach; ?>
</table>